package com.situ.day21;

import com.situ.day20.Student;
import com.situ.day20.Teacher;
import org.junit.Test;

import java.util.ArrayList;
import java.util.List;

public class Generic {

    @Test
    public void testGeneric() throws Exception {
        // 集合的声明
        List list = new ArrayList();
        list.add("China");
        list.add(1);

        // 集合的使用
        String str = (String) list.get(0);
    }

    @Test
    public void test2() {
        Student student = new Student();
        Student student1 = new Student();
        BaseDao<Student> baseDao1 = new BaseDao<>();
        baseDao1.add(student);
        baseDao1.update(student);

        Teacher teacher = new Teacher();
        BaseDao<Teacher> baseDao2 = new BaseDao<>();
        baseDao2.add(teacher);
        baseDao2.update(teacher);
    }

    }
